import { getHttp, postHttp, postHttpMulti, postHttpParam, putHttp } from "../index";

/********************** 重置密码***********************/

// 定义发送邮箱验证码 函数
export const getEmailCode = (email: string) =>
  getHttp("/health/doctor/v1/sendEmailCode", { email }, {});

// 定义校验验证码 函数
export const checkCode = (email: string, code: string) =>
  postHttp("/health/doctor/v1/checkCode", { email, code }, {});

// 定义重置用户密码 函数
export const resetUserPwd = (email: string, pwd1: string, pwd2: string) =>
  putHttp("/health/doctor/v1/resetUserPwd", { email, pwd1, pwd2 }, {});

/********************** 我的被采纳建议***********************/

// 定义查询我的被采纳的建议 函数
export const getMyAdoptedCommentList = (
  page: number,
  count: number,
  doctorId: number,
  sessionId: string
) =>
  getHttp(
    "/health/doctor/verify/v1/findMyAdoptedCommentList",
    {
      page,
      count,
    },
    {
      doctorId,
      sessionId,
    }
  );

/********************** 我的注册***********************/

// 定义查询科室列表 函数
export const getDepartment = () =>
  getHttp("/health/share/knowledgeBase/v1/findDepartment");

// 定义查询医生职称列表 函数
export const getJobTitleList = () =>
  getHttp("/health/doctor/v1/findJobTitleList");

/********************** 我的消息***********************/

// 定义查询系统通知消息
export const getDoctorSystemNoticeList = (page: number, count: number) =>
  getHttp("/health/doctor/verify/v1/findDoctorSystemNoticeList", {
    page,
    count,
  });

// 定义查询问诊通知消息
export const getDoctorInquiryNoticeList = (page: number, count: number) =>
  getHttp("/health/doctor/verify/v1/findDoctorInquiryNoticeList", {
    page,
    count,
  });

// 定义查询H币通知消息
export const getDoctorHealthyCurrencyNoticeList = (
  page: number,
  count: number
) =>
  getHttp("/health/doctor/verify/v1/findDoctorHealthyCurrencyNoticeList", {
    page,
    count,
  });

// 定义查询医生未读消息数
export const getDoctorNoticeReadNum = () =>
  getHttp("/health/doctor/verify/v1/findDoctorNoticeReadNum");

// 定义修改消息状态为全部已读
export const putModifyAllStatus = () =>
  putHttp("/health/doctor/verify/v1/modifyAllStatus");

/********************** 我的资料***********************/
// 获取医生信息
export const getDoctorById = (doctorId: number, sessionId: string) =>
  getHttp(
    "/health/doctor/verify/v1/findDoctorById",
    {},
    { doctorId, sessionId }
  );
// 定义上传形象照
export const postImagePic = (imagePic: File, doctorId: number, sessionId: string) => {

  const formData = new FormData();
  formData.append('imagePic', imagePic, imagePic.name)

  return postHttp(
    '/health/doctor/verify/v1/uploadImagePic',
    formData,
    { doctorId, sessionId }
  )
}

/********************** 个人信息 ***********************/
// 定义查询系统形象照
export const getSystemImagePic = () =>
  getHttp('/health/doctor/v1/findSystemImagePic')

// 定义选择系统提供形象照
export const postChooseImagePic = (imagePic: string) =>
  postHttpParam('/health/doctor/verify/v1/chooseImagePic', {
    imagePic
  })